﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
using System.IO;

namespace WangPuyang
{
    public class FileMD5  :Dictionary<string,string[]>
    {
        public static string GetFileMD5(string path)
        {
            //path = @"C:\Users\WangSong\Pictures\2005-11-22\001.jpg";
            FileStream get_file = new FileStream(path, FileMode.Open, FileAccess.Read,  FileShare.Read);

            MD5CryptoServiceProvider get_md5 = new MD5CryptoServiceProvider();

            byte[] hash_byte = get_md5.ComputeHash(get_file);
            get_file.Close();

            string resule = System.BitConverter.ToString(hash_byte);
            resule = resule.Replace("-", "");

            

            return resule;
        }


        public void ReAdd(string strkey,string newvalue)
        {
            string[] temp = this[strkey];

            Array.Resize(ref temp, temp.Length + 1);
            temp[temp.Length - 1] = newvalue;
            this[strkey] = temp;
        }
     
       

      

    }

    
}
